const express = require('express');
const compression = require('compression');
// const path = require('path');
// const fs = require('fs');
const app = express()
const args= process.argv.slice(2)
const PORT = parseInt(args) //process.env.PORT || 4000;

app.set('views', 'static');
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'html');
app.use(compression());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(express.static('static'));

app.get('*', (req, res) => {
    res.render('index.html')
});

app.listen(PORT, () => {
    console.log(`监听端口:${args}`)
    console.log(`Node Express server listening on http://localhost:${PORT}`);
   
});